<template>
  <view class="box">
    {{ message }}
    <p class="bgc-222222">hello scss</p>
  </view>
  <van-button type="primary" @click="show">主要按钮</van-button>
  <p class="text-primary">hello vue3</p>
</template>

<script setup>
import { ref } from "vue";
import { showConfirmDialog } from "vant";
import { getData } from "@/utils/mock.js";
import { useStore } from "vuex";
import { getAppVersion } from "@/api/api";
import uniq from "lodash-es/uniq";
import dayjs from "dayjs";
const message = ref("Hello UniApp v3");
const store = useStore();

console.log(getData());
console.log(store.state.username);
console.log(store.getters.getUserInfo);
console.log(store.getters.getGender);

//lodash uniq去重
console.log(uniq(["js", "css", "js", "html", "css"]));
//获取数据
getAppVersion().then((res) => {
  console.log(res);
});

const now = dayjs().format("YYYY-MM-DD HH:mm:ss");

console.log("当前时间:", now);
const show = () => {
  showConfirmDialog({
    title: "提示",
    message: "vant 提示！",
    confirmButtonText: "确定",
    cancelButtonText: "取消",
  })
    .then(() => {
      console.log("用户点击了确定");
    })
    .catch(() => {
      // 点击取消按钮的回调
      console.log("用户点击了取消");
    });
};
</script>

<style lang="scss">
.box {
  background: $uni-color-primary;
  margin: 10rpx;
  margin-bottom: 10rpx;
  p {
    color: $uni-color-success;
  }
}
</style>
